import { Counter } from '../../types';
import * as types from '../action-types';
import { Action } from '../actions/Counter';

let initState: Counter = {
    number: 0
}

export default function (state = initState, action: Action) {
    switch (action.type) {
        case types.INCREMENT:
            return { number: state.number + 1 }
        case types.DECREMENT:
            return { number: state.number - 1 }
    }
    return state
}